﻿Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Web.Script.Services
Imports Newtonsoft.Json
Imports System.Text
Imports System.Collections.Generic

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
' <System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class LSKWebService
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function HelloWorld() As String
        Return "Hello World"
    End Function

    <WebMethod()> _
    <ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
    Public Function QueryData(ByVal State As Integer) As WS.PropertyDetailDTO

        Dim clist As New List(Of WS.PropertyDetailDTO)
        Dim c As New WS.PropertyDetailDTO
        c.StatusProcess = 1
        c.StatusProcessTotal = 10

        Return c
    End Function

    <WebMethod()> _
    <ScriptMethod(ResponseFormat:=ResponseFormat.Json, UseHttpGet:=True)> _
    Public Sub QueryRet()

        Dim clist As New List(Of WS.PropertyDetailDTO)
        Dim c As New WS.PropertyDetailDTO
        Dim callback As String
        callback = "Test"
        c.StatusProcess = "1"
        c.StatusProcessTotal = "10"
        Dim sb As New StringBuilder
        sb.Append(callback + "(")
        sb.Append(JsonConvert.SerializeObject(c, Formatting.Indented))
        sb.Append(");")
        Context.Response.Clear()
        Context.Response.ContentType = "application/json"
        Context.Response.Write(sb.ToString())
        Context.Response.End()
    End Sub
End Class